package com.hisicom.scqxspxcjc.controller;

import com.hisicom.scqxspxcjc.base.bean.Result;
import com.hisicom.scqxspxcjc.services.ResultDecisionServiceBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author zhonggls
 * @date 2023/9/7 15:02
 * @Explain
 */
@RestController
@RequestMapping("sceneCheck/resultDecision")
public class ResultDecisionController {
    @Autowired
    ResultDecisionServiceBus resultDecisionServiceBus;


    /**
     * 通过组id获取"缺陷和问题描述"栏对象集合
     * @param groupId 分组id
     * @return "缺陷和问题描述"栏对象集合
     */
    @GetMapping(value = "findResultDecisionList")
    public Object findResultDecisionList(String groupId) {
        Object object = resultDecisionServiceBus.findResultDecisionList(groupId);
        return Result.success(object);
    }

    /**
     * 通过组id获取缺陷项
     * @param groupId 组id
     * @return
     */
    @GetMapping(value = "findByGroupIdAndResultNo")
    public Object findByGroupIdAndResultNo(String groupId) {
        return Result.success(resultDecisionServiceBus.findByGroupIdAndResultNo(groupId));
    }

    /**
     * 保存"缺陷和问题描述" 对象集合
     * @param params "缺陷和问题描述"对象集合数据
     * @return 成功/失败
     */
    @PostMapping(value = "addDecisionBusiness")
    public Object addDecisionBusiness(@RequestBody Map params)  {
        resultDecisionServiceBus.addDecisionBusiness(params);
        return Result.success();
    }
}
